<?php
session_start();

$result = 0;
if (isset($_GET['bookId'])) {
	$bookId = $_GET['bookId'];
	if (isset($_SESSION['cart'][$bookId])) {
		$_SESSION['cart'][$bookId]++;
	} else {
		$_SESSION['cart'][$bookId] = 1;
	}
	foreach ($_SESSION ['cart'] as $value) {
		$result += $value;
	}
	$_SESSION['totalQty']=$result;
	echo json_encode($result);
	return;
}
?>